package com.memory.api.controller.inner;

import com.memory.api.service.InterfaceInfoService;
import com.memory.common.model.entity.InterfaceInfo;
import com.memory.client.feignClient.InterfaceInfoFeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 该服务仅内部调用，不是给前端的
 */
@RestController
@RequestMapping("/interface/inner")
public class InterfaceInnerController implements InterfaceInfoFeignClient {

    @Resource
    private InterfaceInfoService interfaceInfoService;

    /**
     * 从数据库中查询模拟接口是否存在（请求路径、请求方法、请求参数）
     *
     * @param path
     * @param method
     * @return
     */
    @Override
    @GetMapping("/get/interfaceInfo")
    public InterfaceInfo getInterfaceInfo(String path, String method) {
        return interfaceInfoService.getInterfaceInfo(path, method);
    }
}